package com.jfirer.redisserver.command.impl;

import com.jfirer.jnet.common.api.ProcessorContext;
import com.jfirer.redisserver.RedisCore;
import com.jfirer.redisserver.command.Command;
import com.jfirer.redisserver.datatype.BytesWrapper;
import com.jfirer.redisserver.resp.BulkString;
import com.jfirer.redisserver.resp.Resp;
import com.jfirer.redisserver.resp.RespArray;

public abstract class AbstraceScan implements Command
{

    @Override
    public void handle(ProcessorContext ctx, RedisCore redisCore)
    {
        Resp[]     array       = new Resp[2];
        BulkString blukStrings = new BulkString(new BytesWrapper("0".getBytes(CHARSET)));
        array[0] = blukStrings;
        array[1] = get(redisCore);
        ctx.fireWrite(new RespArray(array));
    }

    protected abstract RespArray get(RedisCore redisCore);
}
